import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = in.nextInt();
        }
        int lenMax = -1;
        for (int i = 0; i < n; i++) {
            int cur = 1;
            for (int j = i; j < n; j++) {
                cur *= nums[j];
                if (judgeIfQ(cur)) {
                    lenMax = Math.max(lenMax, j - i + 1);
                }
            }
        }
        System.out.println(lenMax);

    }
    private static boolean judgeIfQ(int x) {
        int a = (int) Math.sqrt(x);
        return x == a * a;
    }
}